iT邦幫忙

2021 iThome 鐵人賽

DAY 20
0
Software Development

LINE機器人學習歷程系列 第 20

[DAY20]圖片旋轉木馬

  • 分享至 

  • xImage
  •  

TemplateSendMessage - ImageCarouselTemplate

image_carousel_template_message = TemplateSendMessage(
    alt_text='ImageCarousel template',
    template=ImageCarouselTemplate(
        columns=[
            ImageCarouselColumn(
                image_url='https://example.com/item1.jpg',
                action=PostbackAction(
                    label='postback1',
                    display_text='postback text1',
                    data='action=buy&itemid=1'
                )
            ),
            ImageCarouselColumn(
                image_url='https://example.com/item2.jpg',
                action=PostbackAction(
                    label='postback2',
                    display_text='postback text2',
                    data='action=buy&itemid=2'
                )
            )
        ]
    )
)

Image carousel template
Template with multiple images which can be cycled like a carousel. The images are shown in order when scrolling horizontally.

type
String Required
image_carousel
跟旋轉木馬相同欄位最多10個
columns
Array of column objects Required
Array of columns
Max columns: 10
模板只能用矩形的
Column object for image carousel
imageUrl
String Required
Image URL (Max character limit: 2,000)
HTTPS over TLS 1.2 or later
JPEG or PNG
Aspect ratio: 1:1
Max width: 1024px
Max file size: 10 MB
當圖片被按下後的動作及圖片的表現
action
Action object Required
Action when image is tapped
https://ithelp.ithome.com.tw/upload/images/20211004/20140159K6zzaqcbWb.png


上一篇
[DAY19]旋轉木馬(02)
下一篇
[DAY21]彈性訊息
系列文
LINE機器人學習歷程30
圖片
  直播研討會
圖片
{{ item.channelVendor }} {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

尚未有邦友留言

立即登入留言